<template>
    <div ref="chart" style="width:100%; height:100%;"></div>
</template>

<script>
import * as echarts from 'echarts/core'
export default {
    props:{
        typeChart:{
            type:String,
            default:'line'
        }
    },
    data(){
        return {

        }
    },
    mounted(){
        this.initChart();
    },
    methods:{
        initChart(){
            //基于准备好的dom初始化echarts实例
            var myChart=echarts.init(this.$refs.chart)
            //指定图标配置项数据
          var  option = {
                xAxis: {
                    type: 'category',
                    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                    data: [150, 230, 224, 218, 135, 147, 260],
                    type: this.typeChart
                    }
                ]
            };
                //展示
            myChart.setOption(option);
        }
    }
}
</script>